/*
---
name: MPG.OrientationControl

description:

license: MIT-style

authors:
- Noritaka Horio

requires:
  - Core/Core
  - Core/Function
  - Core/Element
  - Core/Element.Event
  - Core/Class
  - Core/Class.Extras

provides: [MPG.OrientationControl]

...
*/
(function($){

	var MPG = this.MPG = (this.MPG || {});

	MPG.OrientationControl = new Class({

		Implements: [MPG.Control],

		initialize: function(options){
			this.setOptions(options);
		},

		_onOrientationChange: function(event){
			switch(window.orientation) {
				//landscape
				case 90:
				case -90:
					this.controller.landscapeAction();
					break;
				//portrait
				case 0:
				case 180:
					this.controller.portraitAction();
					break;
				default:
			}
		},

		initControl: function(){
			var self = this;
			window.addEvent('orientationchange', this._onOrientationChange.bind(self));
		}

	});

}(document.id));
